#ifndef _LYMPH_MULTIBOOT2_H_
#define	_LYMPH_MULTIBOOT2_H_

#include <Types.h>

namespace Multiboot2
{
	class MemoryMap
	{
	public:
		MemoryMap();
		MemoryMap(const MemoryMap &copy);
		~MemoryMap();
		
		bool IsOver16() const;
		bool IsAvailable() const;
		
		uintptr_t GetBase() const;
		size_t GetLength() const;
		
	private:
		uint64_t base;
		uint64_t length;
		uint32_t type;
		uint32_t unused;
	} PACKED;
	
	struct TagHeader
	{
		TagHeader();

		uint32_t Type;
		uint32_t Size;
	} PACKED;

	class Header
	{
	public:
		enum TagType
		{
			End,
			CmdLine,
			BootLoaderName,
			Modules,
			MemInfo,
			BootDevice,
			MemoryMap,
			VbeInfo,
			FrameBuffer,
			ElfSections,
			ApmTable
		};

		bool HasTag(TagType type) const;
		TagHeader &GetTag(TagType type) const;

		size_t GetMemoryMapsCount() const;
		const Multiboot2::MemoryMap &GetMemoryMap(size_t n) const;
		
		size_t GetSize() const;
		
	private:
		uint32_t Size;
		uint32_t Reserved;
	} PACKED;
}

#endif

